package com.yxy.controller.admin;

import com.yxy.common.PageResult;
import com.yxy.common.Result;
import com.yxy.constant.RequestMapperConstant;
import com.yxy.pojo.dto.SightsBookingPageQueryDTO;
import com.yxy.service.SightsBookingService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController("adminSightsBookingController")
@RequestMapping(RequestMapperConstant.ADMIN_REQUEST_MAPPER + "sightsBooking")
@Slf4j
public class SightsBookingController {

    @Autowired
    private SightsBookingService sightsBookingService;

    /**
     * 分页查询景点预定信息
     * @param sightsBookingPageQueryDTO
     * @return
     */
    @GetMapping("/getSightsBookingList")
    public Result<PageResult> page(SightsBookingPageQueryDTO sightsBookingPageQueryDTO){
        log.info("分页查询景点预定信息：{}", sightsBookingPageQueryDTO);
        PageResult pageResult = sightsBookingService.page(sightsBookingPageQueryDTO);
        return Result.success("", pageResult);
    }

    /**
     * 导出景点预定信息
     * @return
     */
    @GetMapping("/exportSightsBookingList")
    public Result<String> exportToExcel(){
        log.info("导出景点预定信息");
        String filePath = sightsBookingService.exportToExcel();
        return Result.success("", filePath);
    }
}
